from rosa.rosa_apps.memory_apps.types import UserQueryData
from rosa.rosa_apps.memory_apps.views import router as memory_router
from rosa.scarborough_fair import logger, settings


async def on_startup():
    if settings.AUTH_ENABLE and settings.AUTH_TYPE == 'local':
        # 添加默认的本地用户
        memory_router.models.append(UserQueryData(
            id=1,
            username="username",
            password="password",
            name="测试用户",
            superuser=True,
            login_type="local",
            roles=[1]
        ))
    logger.info("Starting up...")


async def on_shutdown():
    logger.info("Shutting down...")
